<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MTB CAT1 Peripheral driver library: Sample and Hold Functions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="IFXCYP_one-line.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MTB CAT1 Peripheral driver library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__group__ctb__functions__sample__hold.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Sample and Hold Functions<div class="ingroups"><a class="el" href="group__group__ctb.html">CTB          (Continuous Time Block)</a> &raquo; <a class="el" href="group__group__ctb__functions.html">Functions</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<p>This function enables sample and hold of the CTDAC output. </p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga08a0df606bea1204aa32ea5d343ac650"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__ctb__functions__sample__hold.html#ga08a0df606bea1204aa32ea5d343ac650">Cy_CTB_DACSampleAndHold</a> (<a class="el" href="struct_c_t_b_m___type.html">CTBM_Type</a> *base, <a class="el" href="group__group__ctb__enums.html#ga3f70d00ef0ce087244399f0784065502">cy_en_ctb_sample_hold_mode_t</a> <a class="el" href="group__group__ipc__bt__data__structures.html#ga37e90f5e3bd99fac2021fb3a326607d4">mode</a>)</td></tr>
<tr class="memdesc:ga08a0df606bea1204aa32ea5d343ac650"><td class="mdescLeft">&#160;</td><td class="mdescRight">Perform sampling and holding of the CTDAC output.  <a href="#ga08a0df606bea1204aa32ea5d343ac650">More...</a><br /></td></tr>
<tr class="separator:ga08a0df606bea1204aa32ea5d343ac650"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga08a0df606bea1204aa32ea5d343ac650"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga08a0df606bea1204aa32ea5d343ac650">&#9670;&nbsp;</a></span>Cy_CTB_DACSampleAndHold()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Cy_CTB_DACSampleAndHold </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_c_t_b_m___type.html">CTBM_Type</a> *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__ctb__enums.html#ga3f70d00ef0ce087244399f0784065502">cy_en_ctb_sample_hold_mode_t</a>&#160;</td>
          <td class="paramname"><em>mode</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Perform sampling and holding of the CTDAC output. </p>
<p>To perform a sample or a hold, a preparation step must first be executed to open the required switches. Because of this, each sample or hold requires three function calls:</p>
<ol type="1">
<li>Call this function to prepare for a sample or hold</li>
<li>Enable or disable the CTDAC output</li>
<li>Call this function again to perform a sample or hold</li>
</ol>
<p>It takes 10 us to perform a sample of the CTDAC output to provide time for the capacitor to settle to the new value.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>Pointer to structure describing registers</td></tr>
    <tr><td class="paramname">mode</td><td>Mode to prepare or perform a sample or hold, or disable the ability</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None</dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd></dd></dl>
<div class="fragment"><div class="line">    <span class="comment">/* Scenario: Opamp0 has been configured as a buffer for the CTDAC output</span></div><div class="line"><span class="comment">     * with the sample and hold (S/H) capacitor connected.</span></div><div class="line"><span class="comment">     * This code samples the CTDAC output once. */</span></div><div class="line">    </div><div class="line">    <span class="comment">/* Prepare for sample. */</span></div><div class="line">    <a class="code" href="group__group__ctb__functions__sample__hold.html#ga08a0df606bea1204aa32ea5d343ac650">Cy_CTB_DACSampleAndHold</a>(CTBM0, <a class="code" href="group__group__ctb__enums.html#gga3f70d00ef0ce087244399f0784065502a2f976a4311b8408fd3b0b4ff7f77bf86">CY_CTB_SH_PREPARE_SAMPLE</a>);</div><div class="line">    </div><div class="line">    <span class="comment">/* Turn on DAC output. */</span></div><div class="line">    <a class="code" href="group__group__ctdac__functions__basic.html#gaf11a41cf842064d44f9f8cdaeea0a31e">Cy_CTDAC_SetOutputMode</a>(CTDAC0, <a class="code" href="group__group__ctdac__enums.html#gga151d4aa27fabb95182a2494782994ccbaa0eedb42bfda13365d835dcc21ef33e6">CY_CTDAC_OUTPUT_VALUE</a>);</div><div class="line">    </div><div class="line">    <span class="comment">/* Sample DAC output. */</span></div><div class="line">    <a class="code" href="group__group__ctb__functions__sample__hold.html#ga08a0df606bea1204aa32ea5d343ac650">Cy_CTB_DACSampleAndHold</a>(CTBM0, <a class="code" href="group__group__ctb__enums.html#gga3f70d00ef0ce087244399f0784065502a9f91f672b83cefaa830632f026dc77c4">CY_CTB_SH_SAMPLE</a>);</div><div class="line">    </div><div class="line">    <span class="comment">/* Allow time for voltage to settle across the hold capacitor. */</span></div><div class="line">    <a class="code" href="group__group__syslib__functions.html#ga9d2ffe4829c636ad78eaae5043fd6ae6">Cy_SysLib_DelayUs</a>(10);</div></div><!-- fragment --> <dl class="section user"><dt>Function Usage</dt><dd></dd></dl>
<div class="fragment"><div class="line">    <span class="comment">/* Scenario: Turn off the CTDAC output to save power and</span></div><div class="line"><span class="comment">     * hold the output voltage across the S/H capacitor. </span></div><div class="line"><span class="comment">     * The DAC output needs to be turned on and sampled periodically.</span></div><div class="line"><span class="comment">     * See the device datasheet for the hold duration. */</span></div><div class="line">    </div><div class="line">    <span class="comment">/* Prepare for hold. */</span></div><div class="line">    <a class="code" href="group__group__ctb__functions__sample__hold.html#ga08a0df606bea1204aa32ea5d343ac650">Cy_CTB_DACSampleAndHold</a>(CTBM0, <a class="code" href="group__group__ctb__enums.html#gga3f70d00ef0ce087244399f0784065502a47aff94f55efbf7a105f71348fdaf2a1">CY_CTB_SH_PREPARE_HOLD</a>);</div><div class="line">    </div><div class="line">    <span class="comment">/* Turn off DAC output. */</span></div><div class="line">    <a class="code" href="group__group__ctdac__functions__basic.html#gaf11a41cf842064d44f9f8cdaeea0a31e">Cy_CTDAC_SetOutputMode</a>(CTDAC0, <a class="code" href="group__group__ctdac__enums.html#gga151d4aa27fabb95182a2494782994ccbaa3e1dfa33392b66a111cffdeb0df4527">CY_CTDAC_OUTPUT_HIGHZ</a>);</div><div class="line">    </div><div class="line">    <span class="comment">/* Hold voltage. */</span></div><div class="line">    <a class="code" href="group__group__ctb__functions__sample__hold.html#ga08a0df606bea1204aa32ea5d343ac650">Cy_CTB_DACSampleAndHold</a>(CTBM0, <a class="code" href="group__group__ctb__enums.html#gga3f70d00ef0ce087244399f0784065502a04a0f0b544d3cc435b6aa30afaf3e2bd">CY_CTB_SH_HOLD</a>);</div><div class="line">        </div></div><!-- fragment -->
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>MTB CAT1 Peripheral driver library</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
